module.exports = app => {
    const {STRING,DOUBLE} = app.Sequelize;
    // const Student = app.modle.define("student", {
    //     name:STRING,
    //     achievement: DOUBLE
    // })

    const Student = app.model.define('student', { 
        name: STRING,
        achievement: DOUBLE
    })

    Student.associate = function(){ // 所属那个班级 指向班级组件
        app.model.Student.belongsTo(app.model.Clazz,{
            foreignKey: "clazz_id",
            as: "clazz"
        })
    }
    return Student;
}